/*
 * Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef SLE_LITE_TOOL_CONNECT_H
#define SLE_LITE_TOOL_CONNECT_H

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus

#include "kh_sle_connect.h"
#include "cmd_input.h"
#include "sle_hilog.h"
#include <stdio.h>
#include <string.h>
#include <stdint.h>

#ifdef __LITEOS_M__
#include "common_tool.h"
#include "ohos_init.h"
#include "cmsis_os2.h"
#include "utils_file.h"
#endif // __LITEOS_M__


void OnSleTConnStateChangeCb(uint16_t connectId, const SleDeviceAddress *addr
        , SleConnectState connState, SlePairState pairState, SleDisConnectReason discReason);
void OnSleTConnParamUpdatedCb(uint16_t connectId, SleErrorCode errCode, const SleConnectionParamUpdateEvt *connParam);
static SleConnectCallbacks g_connectToolCbs = {
    .OnSleConnStateChangeCb = OnSleTConnStateChangeCb,
    .OnSleConnParamUpdatedCb = OnSleTConnParamUpdatedCb,
};

void TSleConnect(void);
void TSleDisconnect(void);
void TSleUpdateConnParam(void);
void TSleUpdateAllConnParam(void);
void TSleGetRecomSendDataSize(void);
void TSendPairReq(void);
void TRemovePair(void);
void TRemoveAllPairs(void);
void TGetDevicePairState(void);
void TReadRemoteRssi(void);
void TGetConnectDevList(void);
void SleConnectToolHalper(void);

static CmdNode g_connectCmdList[] = {
    //sle_connect_test
    {"SleConnectHalper", SleConnectToolHalper},
    {"SleConnect", TSleConnect},
    {"SleDisconnect", TSleDisconnect},
    {"SleUpdateConnParam", TSleUpdateConnParam},
    {"SleUpdateAllConnParam", TSleUpdateAllConnParam},
    {"SleGetRecomSendDataSize", TSleGetRecomSendDataSize},
    {"SendPairReq", TSendPairReq},
    {"RemovePair", TRemovePair},
    {"RemoveAllPairs", TRemoveAllPairs},
    {"GetDevicePairState", TGetDevicePairState},
    {"ReadRemoteRssi", TReadRemoteRssi},
    {"GetConnectDevList", TGetConnectDevList},
};
static uint16_t g_connectCmdNum = sizeof(g_connectCmdList) / sizeof(CmdNode);
void SleConnectToolCmdHandler(int argc, char **argv);

#ifdef __cplusplus
}
#endif // __cplusplus

#endif // SLE_LITE_TOOL_CONNECT_H